<?php
$_name= $data[adm_name];
$_password = $data[adm_password];
$_contact = $data[adm_contact];
//resultCode,0成功，1不合法，2失败
require_once './connect.php';
//判断是否合法
$resultCode=0;
$resultMsg="未知情况";
if(mb_strlen($_name)<0){
    $resultCode=1;
}
if(!preg_match('/1[3|4|5|7|8][0-9]{9}/',$_contact)){
    $resultCode=1;
}
if(!preg_match('/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,10}/',$_password)){
    $resultCode=1;
}
//查询语句 
$sql = "INSERT INTO _admin(adm_name,adm_password,adm_contact)VALUES ('$_name','$_password','$_contact')";
 if ($conn->query($sql) === TRUE) {
	$resultMsg = '注册成功';
} else {
     $resultCode=2;
    $resultMsg = '注册失败';
}

$response=array(
    'resultCode'=>$resultCode,
    'resultMsg'=>$resultMsg
);
echo json_encode($response);
//echo 'test'.$response;
$conn->close();
?>